﻿using Albatross.WPF.Common.ViewModels;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Albatross.SharePoint.Explorer.ViewModels {
	public class FolderViewModel : ClientObjectViewModel{
		public FolderViewModel(ClientContext context, string name, Folder folder) : base(context, name, folder) { }

		Folder Folder { get { return (Folder)ClientObject; } }

		public override string GetTreeItemTitle() {
			if (Name == string.Empty) {
				if (string.IsNullOrEmpty(Folder.Name)) {
					return @"Root Folder";
				} else {
					return Folder.Name;
				}
			} else {
				return Name;
			}
		}

		public override string GetContentTitle() {
			return string.Format("{0} - {1}", Folder.Name, Folder.ServerRelativeUrl);
		}
	}
}
